<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="formId">
				<div class="select-list">
					<ul>
						<li>
							学生名称：<input type="text" name="stuName"/>
						</li>

						<li>
							学期号：<select name="termNum" th:with="type=${@dict.getType('sys_term_type')}">
							<option value="">所有</option>
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
						</li>

						<li>
							班级号：<select name="classNo" th:with="type=${@dict.getType('sys_class_types')}">
							<option value="">所有</option>
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
						</li>

						<!--<li>-->
							<!--语文成绩：<input type="text" name="scoreChinese"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--数学成绩：<input type="text" name="scoreMath"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--英语成绩：<input type="text" name="scoreEnglish"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--政治成绩：<input type="text" name="scorePolitical"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--历史成绩：<input type="text" name="scoreHistory"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--生物成绩：<input type="text" name="scoreBiology"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--地理成绩：<input type="text" name="scoreGeographical"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--化学成绩：<input type="text" name="scoreChemistry"/>-->
						<!--</li>-->

						<!--<li>-->
							<!--物理成绩：<input type="text" name="scorePhysical"/>-->
						<!--</li>-->

						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:score:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:score:edit">
				<i class="fa fa-edit"></i> 修改
			</a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:score:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
			<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:score:export">
				<i class="fa fa-download"></i> 导出
			</a>
			<a class="btn btn-success" id="upload" shiro:hasPermission="system:score:importExcel">
				<i class="fa fa-upload"></i> 导入
			</a>
		</div>
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:src="@{/ajax/libs/ajaxfile/ajaxupload.js}"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:score:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:score:remove')}]];
    var termdatas = [[${@dict.getType('sys_term_type')}]];
    var classdatas = [[${@dict.getType('sys_class_types')}]];
    var prefix = ctx + "system/score";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            importExcelUrl: prefix + "/importExcel",
            modalName: "成绩",
            search: false,
            showExport: true,
            totalRow:true,
            columns: [{
                checkbox: true
            },
                {
                    field : 'scoreId',
                    title : '成绩主键',
                    visible: false
                },
                {
                    field : 'stuName',
                    title : '学生名称',
                    sortable: true
                },
                {
                    field : 'termNum',
                    title : '学期号',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(termdatas, value);
                    }
                },
                {
                    field : 'classNo',
                    title : '班级号',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(classdatas, value);
                    }
                },
                {
                    field : 'scoreChinese',
                    title : '语文成绩',
                    sortable: true
                },
                {
                    field : 'scoreMath',
                    title : '数学成绩',
                    sortable: true
                },
                {
                    field : 'scoreEnglish',
                    title : '英语成绩',
                    sortable: true
                },
                {
                    field : 'scorePolitical',
                    title : '政治成绩',
                    sortable: true
                },
                {
                    field : 'scoreHistory',
                    title : '历史成绩',
                    sortable: true
                },
                {
                    field : 'scoreBiology',
                    title : '生物成绩',
                    sortable: true
                },
                {
                    field : 'scoreGeographical',
                    title : '地理成绩',
                    sortable: true
                },
                {
                    field : 'scoreChemistry',
                    title : '化学成绩',
                    sortable: true
                },
                {
                    field : 'scorePhysical',
                    title : '物理成绩',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.scoreId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.scoreId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    new AjaxUpload('#upload', {
        action: prefix+"/importExcel",
        name: 'file',
        autoSubmit:true,
        responseType:"json",
        onSubmit:function(file, extension){
            if (!(extension && /^(jpg|xlsx|jpeg|png|gif)$/.test(extension.toLowerCase()))){
                alert('只支持jpg、png、gif格式的图片！');
                return false;
            }
        },
        onComplete : function(file, r){
            $.operate.ajaxSuccess(r);
        }
    });
</script>
</body>
</html>